home *** CD-ROM | disk | FTP | other *** search
- /* $VER: CC-All 0.82 (01.05.95)
-
- by Fredrik Bennison
-
- This script parses a message to All and generates <x> copies of the
- message to a list of recipients.
-
- Syntax: rx CC-All.rexx <file>
-
- */
-
- IF ~SHOW(Libraries,'rexxsupport.library') THEN
- IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
-
- parse arg file
-
- cfgpath="Mail:CrashMail/"
- inbpath="Mail:CrashMail/Inbound/"
-
- toname=""
- toaddr=""
- fromname=""
- fromaddr=""
- subject=""
- x=0
-
- call open('file',file,'R')
-
- /* keep going */
-
- kg=TRUE
-
- do while kg=TRUE
- str = readln('file')
-
- if eof('file') then do
- kg=FALSE
- end
- else if length(str)=0 then do
-
- /* *** Empty line = End of header *** */
-
- kg=FALSE
- end
- else do
- if left(str,5)="From:" then parse var str 'From: 'fromaddr'@'dummy' ('fromname')'
- if left(str,3)="To:" then parse var str 'To: 'toaddr'@'dummy' ('toname')'
- if left(str,8)="Subject:" then subject=right(str,length(str)-9)
- if left(str,11)="X-Fido-Via" then do
- x=x+1
- Via.x='01'x||right(str,length(str)-7)
- end
- end
- end
-
- call open('out','T:CC.out','W')
- call writeln('out','01'x||'PID: CC-All v0.82')
- call writeln('out',' *! Message sent by CC-All v0.82 at '||toaddr||' !*')
- call writeln('out','')
-
- do while ~eof('file')
- str = readln('file')
- call writeln('out',str)
- end
-
- if x>0 then
- do a=1 to x
- call writeln('out',Via.a)
- end
-
- call close('file')
- call close('out')
-
- parse var toaddr zon':'net'/'node'.'point
-
- cfgfile = cfgpath||zon||'.'||net||'.'||node||'.'||point||'.CC'
-
- call open('cfg',cfgfile,'R')
-
- str = readln('cfg')
-
- do while ~eof('cfg')
- parse var str toname' @ 'toaddr
-
- IF toaddr~=fromaddr THEN
- address command 'Mail:CrashMail/CrashWrite FN "'fromname'" FA 'fromaddr' TN "'toname'" TA 'toaddr' SUBJ "'subject'" DIR 'inbpath' TEXT T:CC.out'
- str = readln('cfg')
- end
-
- call close('cfg')
- call delete("T:CC.out")
-
- exit 0
-